package algorithm.doublePointer;

// 盛最多水的容器
public class LC11 {
    public int maxArea(int[] height) {
        int left = 0, right = height.length - 1, max = 0;

        while (left < right) {
            int v = 0;
            if (height[left] > height[right]) {
                v = (right - left) * height[right];
                right--;
            } else {
                v = (right - left) * height[left];
                left++;
            }
            max = Math.max(max, v);
        }
        return max;
    }
}
